﻿@model ShipmentModel
@{
    ViewBag.Title = string.Format(T("Admin.Orders.Shipments.AddNew.Title").Text, Model.OrderId);
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            @string.Format(T("Admin.Orders.Shipments.AddNew.Title").Text, Model.OrderId) @Html.ActionLink("(" + T("Admin.Orders.Shipments.BackToOrder") + ")", "Edit", new { id = Model.OrderId })
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="btn btn-warning">
				<i class="fa fa-check"></i>
				<span>@T("Admin.Common.Save")</span>
			</button>
            <button type="submit" name="save" value="save-continue" class="btn btn-secondary">
				<span>@T("Admin.Common.SaveContinue")</span>
			</button>          
        </div>
    </div>

    @Html.ValidationSummary(false)

    <table class="adminContent mb-5">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.TrackingNumber)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.TrackingNumber)
            </td>
        </tr>
    </table>

	<h5>@T("Admin.Orders.Shipments.Products")</h5>
	
	<div class="table-responsive">
		<table class="table admin-table">
			<thead>
				<tr>
					<th>
						@T("Admin.Orders.Shipments.Products.ProductName")
					</th>
					<th>
						@T("Admin.Orders.Shipments.Products.SKU")
					</th>
					<th>
						@T("Admin.Orders.Shipments.Products.QtyOrdered")
					</th>
					<th>
						@T("Admin.Orders.Shipments.Products.QtyShipped")
					</th>
					<th>
						@T("Admin.Orders.Shipments.Products.QtyToShip")
					</th>
				</tr>
			</thead>
			<tbody>
				@foreach (var item in Model.Items)
				{
					<tr>
						<td style="width: 50%;">
							@Html.LabeledProductName(item.ProductId, item.ProductName, item.ProductTypeName, item.ProductTypeLabelHint)
							@if (!String.IsNullOrEmpty(item.AttributeInfo))
							{
								<br />
								@Html.Raw(item.AttributeInfo)
							}
						</td>
						<td style="width: 10%;">
							@item.Sku
						</td>
						<td align="center" style="width: 10%;">
							@item.QuantityOrdered
						</td>
						<td align="center" style="width: 10%;">
							@item.QuantityInAllShipments
						</td>
						<td align="center" style="width: 20%;">
							<input name="qtyToAdd@(item.OrderItemId)" type="text" value="@item.QuantityToAdd" id="qtyToAdd@(item.OrderItemId)" style="width:100px;" class="form-control" />
						</td>
					</tr>
				}
			</tbody>
		</table>
	</div>
}